//
//  SecondViewController.m
//  UI3_UIImageView
//
//  Created by dllo on 15/11/10.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "SecondViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController




- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor greenColor];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(200, 200, 50, 50);
    button.backgroundColor = [UIColor blueColor];
    [button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    NSLog(@"aaaaaaa");

    
}

- (void)buttonAction
{
    
    // 切回原来界面
    // 参数1 - 是否需要动画
    // 参数2 - block - 切换完成调用
    // 注意: 新建rootVC的方式是切换到新的rootVC界面, 而非切回原来的rootVC界面
    [self dismissViewControllerAnimated:YES completion:^{
        NSLog(@"%d", __LINE__);
        
    }];
    
    NSLog(@"%d", __LINE__);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
